/* 
 * File: main.cpp
 * Project: QTimeTracker
 * Author: Steve Sindelar, http://stevesindelar.cz
 * Licence: NewBSD licence.
 */

#include "qtimetracker.h"
#include <QtGui/QApplication>
#include <QList>
#include "../QTimeTracker.Core/timespan.h"
#include "../QTimeTracker.Core/xmlpersister.h"
#include "../QTimeTracker.Core/item.h"

using namespace Ui;

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
	QApplication::setQuitOnLastWindowClosed(false);
    QTimeTracker w(a);
	if (!w.isValid()) {
		return 1;	//QTimeTracker object might be invalid when it failed to load some resources
	}

	w.show();
    return a.exec();
}


// index page for Doxygen:

/*! \mainpage QTimeTracker
 *
 * QTimeTracker is software for measuring time written in C++ and Qt.
 * Source code is divided into two main namespaces Core and Ui.
 *
 * Core namespace contains main data structures and algorithms for saving and loading them into/from a file and exporting to CSV.
 * This namespace is not dependent on any UI, but it uses some of Qt core classes like QList.
 *
 * Ui namespace contains classes for GUI handling. The GUI is done using the Qt GUI framework 
 * and also QDesigner. QDesigner files are converted to C++ code using Qt utils.
 * 
 * \section Core
 * The main class of the Core namespace is \ref Core::Item "Item". 
 * Item represents one named timer-that is name, note and list of \ref Core::TimeSpan "TimeSpan" objets.
 * TimeSpan represents amount of time between the calls of the methods Start and Stop on \ref Core::Item "Item".
 *
 * Other thing that Core provides is saving and loading lists of \ref Core::Item "Item" objects into/from a xml file. 
 * This is done using the Qt xml framework and handled by the classes \ref Core::XmlPersister "XmlPersister" and 
 * \ref Core::LoadXmlHandler "LoadXmlHandler".
 *
 * Lastly the namespace Core contains the class \ref Core::CsvExporter "CsvExporter" used for 
 * exporting list of \ref Core::Item "Item" objects into the CSV format.
 *
 * \section Ui
 * The main elements of the GUI are tables. One representing list of Items and the other list of TimeSpans of the selectd Item.
 *
 * These tables were done using the Qt MVC framework - in detail by subclassing the QAbstractTableModel class and 
 * implementing methods like rowCount(), data(index), headerData(index), ... 
 * Because such implementation would involve lots of switch or if statements (return different member of Item or TimeSpan for each column)
 * polymorphism was used to delegate work of TableModel to list of \ref Ui::TableModelColumn "TableModelColumn". 
 * Distribution of QAbstractTableModel methods calls is done in the class \ref Ui::AbstractTableModel "AbstractTableModel".
 *  
 */